package cn.iocoder.yudao.module.enterprise.dal.mysql.enterpriseCurriculumVitae;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.enterprise.controller.admin.enterpriseCurriculumVitae.vo.EnterpriseCurriculumVitaeExportReqVO;
import cn.iocoder.yudao.module.enterprise.controller.admin.enterpriseCurriculumVitae.vo.EnterpriseCurriculumVitaePageReqVO;
import cn.iocoder.yudao.module.enterprise.dal.dataobject.enterpriseCurriculumVitae.EnterpriseCurriculumVitaeDO;
import cn.iocoder.yudao.module.enterprise.dal.dataobject.studentEducationalExperience.EnterpriseStudentEducationalExperienceDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 用户简历 Mapper
 *
 * @author 周枫皓
 */
@Mapper
public interface EnterpriseCurriculumVitaeMapper extends BaseMapperX<EnterpriseCurriculumVitaeDO> {

    default PageResult<EnterpriseCurriculumVitaeDO> selectPage(EnterpriseCurriculumVitaePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EnterpriseCurriculumVitaeDO>()
                .likeIfPresent(EnterpriseCurriculumVitaeDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(EnterpriseCurriculumVitaeDO::getPhoneNumber, reqVO.getPhoneNumber())
                .eqIfPresent(EnterpriseCurriculumVitaeDO::getEmail, reqVO.getEmail())
                .eqIfPresent(EnterpriseCurriculumVitaeDO::getSpecialty, reqVO.getSpecialty())
                .eqIfPresent(EnterpriseCurriculumVitaeDO::getSex, reqVO.getSex())
                .likeIfPresent(EnterpriseCurriculumVitaeDO::getLiveCity, reqVO.getLiveCity())
                .likeIfPresent(EnterpriseCurriculumVitaeDO::getEducationalExperience, reqVO.getEducationalExperience())
                .eqIfPresent(EnterpriseCurriculumVitaeDO::getDiploma, reqVO.getDiploma())
                .orderByDesc(EnterpriseCurriculumVitaeDO::getId));
    }

    default List<EnterpriseCurriculumVitaeDO> selectList(EnterpriseCurriculumVitaeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<EnterpriseCurriculumVitaeDO>()
                .likeIfPresent(EnterpriseCurriculumVitaeDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(EnterpriseCurriculumVitaeDO::getPhoneNumber, reqVO.getPhoneNumber())
                .eqIfPresent(EnterpriseCurriculumVitaeDO::getEmail, reqVO.getEmail())
                .eqIfPresent(EnterpriseCurriculumVitaeDO::getSpecialty, reqVO.getSpecialty())
                .eqIfPresent(EnterpriseCurriculumVitaeDO::getEducation, reqVO.getEducation())
                .eqIfPresent(EnterpriseCurriculumVitaeDO::getDiploma, reqVO.getDiploma())
                .orderByDesc(EnterpriseCurriculumVitaeDO::getId));
    }
    //TODO 手写一个count方法返回总数据量 待优化SQL语句-不一定需要连表查询进行count
    Integer countCurriculumVitae(@Param("request") EnterpriseCurriculumVitaePageReqVO request);
    Integer countEnterpriseCurriculumVitae(@Param("request") EnterpriseCurriculumVitaePageReqVO request);

    List<EnterpriseCurriculumVitaeDO> getCurriculumVitaePage(@Param("request")EnterpriseCurriculumVitaePageReqVO request);
    List<EnterpriseCurriculumVitaeDO> getEnterpriseCurriculumVitaePageReqVO(@Param("request")EnterpriseCurriculumVitaePageReqVO request);

    List<EnterpriseStudentEducationalExperienceDO>  getStudentEducationalExperience(@Param("studentId") Long studentId);
}
